/*
 * Created on 14.04.2011
 *
 * @author Benedikt
 *
 * createt first in Project Ch@t
 */

package window;

import interfaces.Variablen;

import java.awt.Color;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;

import listener.MyActionListener;


public class SplitPanel extends JSplitPane implements Variablen {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6308453101045158740L;

	Fenster fenster;
	
	public JPanel empfang, schreiben;
	public JTextArea schreibenArea, empfangArea;
	public JButton sendeButton;
	public JScrollPane scpEmpfang, scpSchreiben;
	
	private MyActionListener mal;

	public SplitPanel(Fenster fenster) {
		this.fenster = fenster;
		setDividerLocation(divLocation);

		empfang = new JPanel(new GridLayout());
		empfang.setBackground(Color.white);
		schreiben = new JPanel(new GridLayout());

		empfangArea = new JTextArea();
		empfangArea.setBackground(Color.white);
		empfangArea.setEnabled(false);
		empfangArea.setDisabledTextColor(Color.black);
		scpEmpfang = new JScrollPane(empfangArea);
		empfang.add(scpEmpfang);

		schreibenArea = new JTextArea();
		schreibenArea.setCursor(getCursor());
		scpSchreiben = new JScrollPane(schreibenArea);
		schreiben.add(scpSchreiben);

		setLeftComponent(empfang);
		setRightComponent(schreiben);

		setOrientation(JSplitPane.VERTICAL_SPLIT);
		
		setMal(new MyActionListener(this, fenster));

	}

	public void setMal(MyActionListener mal) {
		this.mal = mal;
	}

	public MyActionListener getMal() {
		return mal;
	}

}
